﻿<%@ Page Language="C#" MasterPageFile="~/WebAdminWithConfirmation.master" AutoEventWireup="true"
    CodeBehind="managePermissions.aspx.cs" Inherits="Salient.Web.Administration.Security.Permissions.managePermissions" EnableEventValidation="false"%>

<%@ Import Namespace="System.Web.Configuration" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="buttons">
    <asp:Button ValidationGroup="none" runat="server" ID="button1" Text="<%$ Resources:Done %>"
        OnClick="ReturnToPreviousPage" />
</asp:Content>
<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="titleBar">
    <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:ManageAccessRules %>" />
</asp:Content>
<asp:Content ID="Content3" runat="server" ContentPlaceHolderID="content">
    <asp:Literal ID="Literal2" runat="server" Text="<%$ Resources:Instructions %>" />
    <table width="100%">
        <tr>
            <td width="80%">
                <table cellspacing="0" width="100%" cellpadding="4" rules="none" bordercolor="#CCDDEF"
                    border="1" style="border-color: #CCDDEF; border-style: None; border-collapse: collapse;">
                    <tr class="callOutStyle">
                        <td colspan="3">
                            <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:ManageAccessRules %>" />
                        </td>
                    </tr>
                    <tr align="=<% DirectionalityHorizontalAlign.ToString(); %>">
                        <td valign="top" width="200px" align="=<% DirectionalityHorizontalAlign.ToString(); %>">
                            <asp:Panel runat="server" ID="panel1" ScrollBars="auto" Height="150px" Width="200px"
                                CssClass="bodyTextNoPadding">
                                <asp:TreeView runat="server" ID="tv" OnSelectedNodeChanged="TreeNodeSelected" OnTreeNodeExpanded="TreeNodeExpanded"
                                    NodeStyle-CssClass="bodyTextLowPadding">
                                    <RootNodeStyle ImageUrl="../../images/folder.gif" />
                                    <ParentNodeStyle ImageUrl="../../images/folder.gif" />
                                    <LeafNodeStyle ImageUrl="../../images/folder.gif" />
                                    <NodeStyle CssClass="bodyTextLowPadding" />
                                    <SelectedNodeStyle CssClass="bodyTextLowPaddingSelected" />
                                </asp:TreeView>
                            </asp:Panel>
                        </td>
                        <td valign="top">
                            <asp:GridView runat="server" ID="dataGrid" BorderColor="#CCDDEF" AllowSorting="true"
                                GridLines="Horizontal" BorderStyle="None" CellPadding="4" AutoGenerateColumns="False"
                                OnRowDataBound="ItemDataBound" Width="100%" UseAccessibleHeader="true">
                                <RowStyle CssClass="gridRowStyle" />
                                <AlternatingRowStyle CssClass="gridAlternatingRowStyle" />
                                <HeaderStyle CssClass="callOutStyle" Font-Bold="true" />
                                <SelectedRowStyle CssClass="gridSelectedRowStyle" />
                                <PagerStyle ForeColor="#000000" BackColor="#EEEEEE" />
                                <PagerSettings Mode="Numeric" />
                                <Columns>
                                    <asp:TemplateField HeaderText="<%$ Resources:Select%>" Visible="false">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="Linkbutton01" runat="server" CommandName="Select" ForeColor='black'
                                                OnClick="SelectClick" Text="" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<%$ Resources:Permission %>">
                                        <ItemTemplate>
                                            <asp:Label runat="server" ID="select" Enabled="<%# IsEntryDeleteable(((GridViewRow) Container).RowIndex) %>"
                                                Text="<%#GetAction((AuthorizationRule)Container.DataItem)%>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<%$ Resources:UsersAndRoles %>">
                                        <ItemTemplate>
                                            <asp:LinkButton runat="server" ID="selectme" Enabled="<%# IsEntryDeleteable(((GridViewRow) Container).RowIndex) %>"
                                                ForeColor="black" OnClick="SelectClick" Text="<%#GetUsersAndRoles((AuthorizationRule)Container.DataItem, true)%>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="<%$ Resources:Delete %>">
                                        <ItemTemplate>
                                            <asp:LinkButton runat="server" ID="delete" Enabled="<%# IsEntryDeleteable(((GridViewRow) Container).RowIndex) %>"
                                                ForeColor='black' OnClick="DeleteRule" Text="<%$ Resources:Delete %>" ToolTip='<%# GetToolTip("Delete",GetUsersAndRoles((AuthorizationRule)Container.DataItem, false)) %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <asp:LinkButton runat="server" ID="linkButton02" CssClass="bodyTextNoPadding" Text="<%$ Resources:AddNewAccessRule %>"
                                OnClick="RedirectToCreatePermission" />
                        </td>
                        <td valign="top">
                            <asp:Button runat="server" ID="moveUp" Text="<%$ Resources:MoveUp %>" Enabled="false"
                                OnClick="MoveRuleUp" Width="110px" />
                            <br />
                            <asp:Button runat="server" ID="moveDown" Text="<%$ Resources:MoveDown %>" Enabled="false"
                                OnClick="MoveRuleDown" Width="110px" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<%-- Confirmation Dialog --%>
<asp:Content ID="Content4" runat="server" ContentPlaceHolderID="dialogTitle">
    <asp:Literal ID="Literal4" runat="server" Text="<%$ Resources:RuleManagement %>" />
</asp:Content>
<asp:Content ID="Content5" runat="server" ContentPlaceHolderID="dialogContent">
    <img src="../../Images/alert_lrg.gif" />
    <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:AreYouSure %>" />
    "<asp:Label runat="server" ID="RuleDescription" />"?
</asp:Content>
<asp:Content ID="Content6" runat="server" ContentPlaceHolderID="dialogBottomLeftButton">
    <asp:Button ID="Button03" runat="server" OnClick="Yes_Click" Text="<%$ Resources:Yes %>"
        Width="100" />
</asp:Content>
<asp:Content ID="Content7" runat="server" ContentPlaceHolderID="dialogBottomRightButton">
    <asp:Button ID="Button04" runat="server" OnClick="No_Click" Text="<%$ Resources:No %>"
        Width="100" />
</asp:Content>
